#include<bits/stdc++.h>
using namespace std;
const int N=502;
const int M=1025;

int m;
int deg[N];
int edges[N][N];
set<int> points;
stack<int> sta;

void dfs(int s){
    for(auto t:points){
        if(edges[s][t]>0){
            edges[s][t]--;edges[t][s]--;
            dfs(t);
        }
    }
    sta.push(s);
}

int main(){
    scanf("%d",&m);
    memset(deg,0,sizeof(deg));
    memset(edges,0,sizeof(edges));
    for(int i=1;i<=m;i++){
        int s,t;
        scanf("%d%d",&s,&t);
        points.insert(s);points.insert(t);
        edges[s][t]++;edges[t][s]++;
        deg[s]++;deg[t]++;
    }
    int st;
    for(auto p:points){
        if(deg[p]%2==1){
            st=p;
            break;
        }
    }
    dfs(st);
    while(!sta.empty()){
        printf("%d\n",sta.top());
        sta.pop();
    }
    return 0;
}